import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

class HLTotal {
  /*
  * 初始化
  * */
  static init() {
    return EasyLoading.init();
  }

  /*
  * 弹框
  * @param status 状态
  * */
  static total(String status) {
    EasyLoading.showToast(status);
  }

  /*
  * 弹框
  * @param status 状态
  * @param message 消息内容
  * */
  static totals({String? status, String? message}) {
    if (status == null && message == null) {
      return;
    }
    EasyLoading.instance.errorWidget = Text(
      status ?? "",
      style: TextStyle(
        fontSize: 18,
        color: Colors.white,
        fontWeight: FontWeight.bold,
      ),
    );
    EasyLoading.showError(message ?? "");
  }

  /*
  * 加载框
  * @param status 状态
  * */
  static progress({String? status}) {
    EasyLoading.show(status: status);
  }

  /*
  * 成功、
  * @param status 状态
  * */
  static success(String status) {
    EasyLoading.showSuccess(status);
  }

  /*
 * 错误、
 * @param status 状态
 * */
  static error(String status) {
    EasyLoading.showError(status);
  }

  /*
 * 详情
 * @param status 状态
 * */
  static info(String status) {
    EasyLoading.showInfo(status);
  }

  /*
 * 消失
 * */
  static dismiss({bool animation = true}) {
    EasyLoading.dismiss(animation: animation);
  }
}
